'use strict';
var path = require('path');

var express = require('express'),
	app = express(),
	config = require('./config');

var YNM = require('ymt-node-watch');

var viewPath = path.join(__dirname,'views/');

app.use(express.static(path.join(__dirname,'dist')));

['list','mylist','detail','clear'].forEach(function(i){
	app.get(new RegExp('/'+i+'(\.html)?$'),function(req, res) {
		res.sendFile(path.join(viewPath,i+'.html'))
	});
});

app.use(express.static('/dist'));

app.use(YNM.setting(config.phrCfg,config.logCfg));

app.listen(config.port,'0.0.0.0', function(err) {
	if(err) console.log(err)
	console.log('Express server listening on port ' + config.port);
});